<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>用户注册</title>

    <!-- Bootstrap -->
    <link href="<%=request.getContextPath() %>/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath() %>/static/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath() %>/static/css/jumbotron.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="<%=request.getContextPath() %>/static/js/html5shiv.min.js"></script>
      <script src="<%=request.getContextPath() %>/static/js/respond.min.js"></script>
    <![endif]-->
    
    <script type="text/javascript">
		function submitForm() {
			var username = document.getElementById("username");
			var password = document.getElementById("password");
			var confirmpassword = document.getElementById("confirmpassword");

			if (username.value == "") {
				alert("用户名不能为空！");
				username.focus();
				return false;
			}
			if (username.value.length < 5) {
				alert("用户名长度不能少于5！");
				username.focus();
				return false;
			}
			if(password.value==""){
				alert("密码不能为空！");
				password.focus();
				return false;
			}
			if(password.value.length<6){
				alert("密码长度不能少于6！");
				password.focus();
				return false;
			}
			if(password.value!=confirmpassword.value){
				alert("密码确认不相等！");
				confirmpassword.focus();
				return false;
			}
			return true;
		}

    </script>
</head>

<body>
<jsp:include page="../Common/navHeader.jsp"></jsp:include>


<div class="container">
<h1 style="font-family:华文行楷;" >好室友<small>网</small> </h1>
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-6">
<form class="form-horizontal" method="post" onsubmit="return submitForm();">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-4 control-label">用户名：</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="username" name="username" placeholder="用户名（长度不少于5个字符）……">
    </div>
  </div>
  
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-4 control-label">用户密码：</label>
    <div class="col-sm-8">
      <input type="password" class="form-control" id="password" name="password" placeholder="密码（长度不少于6个字符）……">
    </div>
  </div>
    
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-4 control-label">确认密码：</label>
    <div class="col-sm-8">
      <input type="password" class="form-control" id="confirmpassword" placeholder="确认密码（必须和密码相同）……">
    </div>
  </div>
  
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-4 control-label">注册提示：</label>
	<div class="col-sm-8 alert alert-warning" role="alert">
		如果您想注册成为管理员用户，请将用户名发送至邮箱：<a href="#" id="contactAdmin">zhouwuai_cpu@163.com</a>。审核完毕，将联系您。审核通过后，将赋予您管理员权限。谢谢合作！
	</div>
  </div>
   
  <div class="form-group">
    <div class="col-sm-offset-4 col-sm-8 col-xs-12">
      <div class="col-sm-6 col-xs-6 text-center">
      <button type="submit" class="btn btn-success">立即注册</button>
      </div>
      <div class="col-sm-6 col-xs-6 text-center">
      <button type="reset" class="btn btn-warning">重新填写</button>
      </div>
    </div>
  </div>
  
  <div class="row">
    <c:if test="${errCode eq 1 }">
      <div class="alert alert-warning" role="alert" id="alert-warning">该用户名已经被使用了！</div>
    </c:if>
  </div>
  
  <input type="hidden" name="action" value="register" />
</form>
</div>
<div class="col-sm-4">
</div>
</div><!--<div class="row">-->
 
    <jsp:include page="../Common/Footer.jsp"></jsp:include>

</div><!--<div class="jumbotron">-->

	<script src="<%=request.getContextPath() %>/static/js/jquery.min.js" ></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="<%=request.getContextPath() %>/static/js/ie10-viewport-bug-workaround.js"></script>
    
    <script >
    
    $("#contactAdmin").click(function() {
    	location.href = "mailto:zhouwuai_cpu@163.com?subject=管理员权限申请";
    	return false;
    });
    
    </script>
    
</body>
</html>
